using System;
using System.Reflection;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using WindowsPhoneEssentials.Storage;
using WindowsPhoneEssentials.Testing.Abstractions;
using WindowsPhoneMVC.Navigation.Interfaces;

namespace WindowsPhoneMVC.Tests.Navigation.Fakes
{
    public class FakePhoenixApplication : IPhoenixApplication
    {
        public FakePhoenixApplication()
        {
            ApplicationTransientState = new TransientStore(new MemoryIsolatedStorateFileFactory(), new FakePhoneApplicationService());
        }

        public void AddAssemblyToScan(Assembly assembly)
        {
            
        }

        public ITransientStore ApplicationTransientState { get; set; }

        public string FrameName { get; set; }

        public event EventHandler<ActivatedEventArgs> Activated;
        public event EventHandler<DeactivatedEventArgs> Deactivated;
        public event EventHandler<ObscuredEventArgs> Obscured;
        public event EventHandler Unobscured;

        public void OnActivated(ActivatedEventArgs e)
        {
            var handler = Activated;
            if (handler != null) handler(this, e);
        }

        public void OnDeactivated(DeactivatedEventArgs e)
        {
            var handler = Deactivated;
            if (handler != null) handler(this, e);
        }

        public void OnObscured(ObscuredEventArgs e)
        {
            var handler = Obscured;
            if (handler != null) handler(this, e);
        }

        public void OnUnobscured(EventArgs e)
        {
            var handler = Unobscured;
            if (handler != null) handler(this, e);
        }
    }
}